<template>
	<view>
		<u--form labelPosition="left" :model="userInfo" :rules="rules" ref="uForm">
			<u-form-item label="名称" prop="phone" borderBottom ref="item1">
				<u--input placeholder="请输入名称" v-model="userInfo.username" border="surround" maxlength="11"></u--input>
			</u-form-item>
			<u-form-item><u-button text="修改" @click="addIntegral" type="primary"></u-button></u-form-item>
		</u--form>
	</view>
</template>

<script>
import {  sysUserName ,update} from "@/api/index.js";
export default {
	data() {
		return {
			userInfo:{}
		};
	},
	onShow() {
		this.sysUserName()
	},
	methods: {
		sysUserName() {
		  sysUserName().then((res) => {
		    if (res.code == 0) {
		      this.userInfo = res.data
		    }
		  })
		},
		addIntegral(){
			update({
				username:this.userInfo.username
			}).then((res)=>{
				if(res.code == 0){
					uni.showToast({
						title: res.msg,
						icon: 'none',
						duration: 2000
					});
				}
			})
		}
	}
};
</script>

<style></style>
